# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-nokia-sparkler
pkgdesc="Nokia 8000 4G"
pkgver=4
pkgrel=0
url="https://postmarketos.org"
license="GPL-2.0-only"
arch="armv7"
options="!check !archcheck"
depends="
	linux-postmarketos-qcom-msm8916
	mkbootimg
	postmarketos-base
	soc-qcom-msm8909
	soc-qcom-msm8916-rproc
"
_pmb_select="soc-qcom-msm8916-rproc"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
makedepends="devicepkg-dev mipi-dbi-cmd"
_panel="nokia,sparkler-gc9307-hlt-28-panel"
source="
	$_panel.txt
	00-nokia-sparkler-display.files
	deviceinfo
	modules-initfs
	"

build() {
	devicepkg_build $startdir $pkgname
	mkdir -p "$builddir"
	mipi-dbi-cmd "$builddir"/"$_panel".bin \
			"$srcdir"/"$_panel".txt
}

package() {
	devicepkg_package $startdir $pkgname
	# Package display init sequence
	install -Dm644 "$builddir"/"$_panel".bin -t \
			"$pkgdir"/lib/firmware/
	install -Dm644 "$srcdir"/00-nokia-sparkler-display.files -t \
			"$pkgdir"/usr/share/mkinitfs/files/
}

nonfree_firmware() {
	pkgdesc="GPU/WiFi/BT/Modem/Video firmware"
	depends="
		firmware-qcom-adreno-a300
		msm-firmware-loader
		firmware-nokia-sparkler-venus
		firmware-nokia-sparkler-wcnss-nv
	"
	mkdir "$subpkgdir"
}

sha512sums="
721d740ff8dbbbafff4bc734228a82bd57d76177b9bf417d660ecb181a72a998319ddbde77d0efc5e875d2256596578212e3e0bfb85c2e77e5bbf6d0e88d9fa4  nokia,sparkler-gc9307-hlt-28-panel.txt
89b3dd5bf1dd5e85bf66bfb6dba56e2a8e919fe3aa7dc369c18c9e56f7e0ae88319186551412497a601081b904c12dd07ebed4f39fd4a4ba6199fb8af9c90f40  00-nokia-sparkler-display.files
e680ec41fabf81718e18963ce9f919509333a9a6e2616e4166a4ca79bdbafd27ace115779cb7112dbdcf8d0b9c3e9204ccedf2524d80b203b29121091316cdc5  deviceinfo
d5dfe844a45cfc4e0844e43b8fb3e1bbcb155e06430188f8d5059fc5ce3c4100fde7f1580b1b54c5318f40d238736b233463582e55b9dd25654e40539e11ed39  modules-initfs
"
